package xj.graph2d.command;

import xj.graph2d.SimpleDrawDocument;
import xj.graph2d.SimpleDrawView;
import xj.graph2d.shapes.PolyShape;

public class MoveVertexCommand extends DeltaCommand {

  public MoveVertexCommand(SimpleDrawView view, SimpleDrawDocument doc,
      PolyShape shape, int pos) {
    super(view, doc, shape);
    this.pos = pos;
  }

  @Override
  protected void forward() {
    ((PolyShape) shape).moveVertex(pos, x, y);
  }

  @Override
  protected void backward() {
    ((PolyShape) shape).moveVertex(pos, -x, -y);
  }

  protected int pos;

}
